/*
 * @Author: Jimmy
 * @LastModifiedBy: Jimmy
 * @Date: 2024-06-25 20:42:14
 * @LastEditTime: 2024-07-07 15:03:18
 * @FilePath: /nest_study/server/src/modules/system/post/dto/index.dto.ts
 */
import { ApiProperty, PartialType } from "@nestjs/swagger";
import { IsArray, IsNumber, IsOptional, IsString, Length } from "class-validator";
import { BaseInfoDto, PaginationDto } from "src/common/dto/index.dto";

export class CreatePostDto extends BaseInfoDto {
    @ApiProperty({ required: true })
    @IsString()
    @Length(0, 100)
    code: string

    @ApiProperty({ required: true })
    @IsString()
    @Length(0, 100)
    name: string
}

export class UpdatePostDto extends PartialType(CreatePostDto) {
    @ApiProperty({
        required: true
    })
    @IsNumber()
    id: number
}

export class QueryPostDto extends PaginationDto {
    @ApiProperty({ required: false })
    @IsOptional()
    @IsString()
    @Length(0, 30)
    name?: string;
}

export class DeletePostrDto {
    @ApiProperty({
        required: true
    })
    @IsArray()
    ids: number[]
}